' BASIC Anywhere Machine program by Charlie Veniot
' Based on 2 Gears Turning mod b+ 2023-02-25 (https://friends-of-basic.freeforums.net/thread/197/2-gears-turning-smallbasic)
screen _newimage(450, 160, 23 )
dim as double a, ao
x_adjust = -50 : y_adjust = -150
DO: Cls ' 2 Gears Turning mod b+ 2023-02-25
  For Z = 0 To 40: For A = 0 To _pi(2) Step .00275
  R = 100 + Cos(20 * A) * 15: X1 = int(Cos(A + ao) * R + 220): Y1 = Sin(A + ao) * R / 3 + 240 - Z / 2
  R = 50 + Sin(-10 * A) * 15: X2 = Cos(A - 2 * ao) * R + 390: Y2 = Sin(A - 2 * ao) * R / 3 + 240 - Z / 2
  if Z < 40 then PSet (X1+x_adjust, Y1+y_adjust), _Rgb(z * 200 / 40 + 55, 0, 0): PSet (X2+x_adjust, Y2+y_adjust), _Rgb(0, 0, z * 200 / 40 + 55)
  If Z = 40 Then Line (220+x_adjust, 240 - Z / 2 + y_adjust)- (X1+x_adjust, Y1 + y_adjust), _Rgb(255, 0, 0): Line (390+x_adjust, 240 - Z / 2+y_adjust)- (X2+x_adjust, Y2+y_adjust), _Rgb(0, 0, 255)
  If Z = 40 Then Line (220+x_adjust, 240 - Z / 2 + y_adjust)- (X1-1+x_adjust, Y1 + y_adjust), _Rgb(255, 0, 0): Line (390+x_adjust, 240 - Z / 2+y_adjust)- (X2-1+x_adjust, Y2+y_adjust), _Rgb(0, 0, 255)
Next A: Next Z
_display
ao = ao + .1
LOOP